home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH12 / 12-2-1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  4.9 KB  |  162 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDBMan 
  3.    Caption         =   "Database Management"
  4.    ClientHeight    =   2910
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   5565
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    LinkTopic       =   "Form1"
  19.    PaletteMode     =   1  'UseZOrder
  20.    ScaleHeight     =   2910
  21.    ScaleWidth      =   5565
  22.    Begin VB.TextBox txtCountry 
  23.       DataField       =   "country"
  24.       DataSource      =   "datCities"
  25.       Height          =   285
  26.       Left            =   1800
  27.       TabIndex        =   5
  28.       Top             =   1560
  29.       Width           =   3495
  30.    End
  31.    Begin VB.TextBox txtCurrency 
  32.       DataSource      =   "datCities"
  33.       Height          =   285
  34.       Left            =   1800
  35.       TabIndex        =   7
  36.       Top             =   2520
  37.       Width           =   3495
  38.    End
  39.    Begin VB.TextBox txtPopulation 
  40.       DataField       =   "pop1995"
  41.       DataSource      =   "datCities"
  42.       Height          =   285
  43.       Left            =   1800
  44.       TabIndex        =   6
  45.       Top             =   2040
  46.       Width           =   3495
  47.    End
  48.    Begin VB.TextBox txtCity 
  49.       DataField       =   "city"
  50.       DataSource      =   "datCities"
  51.       Height          =   285
  52.       Left            =   1800
  53.       TabIndex        =   4
  54.       Top             =   1080
  55.       Width           =   3495
  56.    End
  57.    Begin VB.Data datCities 
  58.       Caption         =   "                  Large World Cities"
  59.       Connect         =   "Access"
  60.       DatabaseName    =   "Megacty2.mdb"
  61.       DefaultCursorType=   0  'DefaultCursor
  62.       DefaultType     =   2  'UseODBC
  63.       Exclusive       =   0   'False
  64.       Height          =   300
  65.       Left            =   120
  66.       Options         =   0
  67.       ReadOnly        =   0   'False
  68.       RecordsetType   =   1  'Dynaset
  69.       RecordSource    =   "Cities"
  70.       Top             =   600
  71.       Width           =   5295
  72.    End
  73.    Begin VB.CommandButton cmdQuit 
  74.       Caption         =   "Exit"
  75.       Height          =   375
  76.       Left            =   4200
  77.       TabIndex        =   2
  78.       Top             =   120
  79.       Width           =   1215
  80.    End
  81.    Begin VB.CommandButton cmdShowCurrency 
  82.       Caption         =   "Show Currency"
  83.       Height          =   375
  84.       Left            =   2280
  85.       TabIndex        =   1
  86.       Top             =   120
  87.       Width           =   1695
  88.    End
  89.    Begin VB.CommandButton cmdOrderByPop 
  90.       Caption         =   "Order by Population"
  91.       Height          =   375
  92.       Left            =   120
  93.       TabIndex        =   0
  94.       Top             =   120
  95.       Width           =   1935
  96.    End
  97.    Begin VB.Label lblCountry 
  98.       Caption         =   "Country:"
  99.       Height          =   255
  100.       Left            =   960
  101.       TabIndex        =   10
  102.       Top             =   1560
  103.       Width           =   735
  104.    End
  105.    Begin VB.Label lblCurrency 
  106.       Alignment       =   1  'Right Justify
  107.       Caption         =   "Currency:"
  108.       Height          =   255
  109.       Left            =   840
  110.       TabIndex        =   9
  111.       Top             =   2520
  112.       Width           =   855
  113.    End
  114.    Begin VB.Label lblPopulation 
  115.       Alignment       =   1  'Right Justify
  116.       Caption         =   "1995 Population:"
  117.       Height          =   255
  118.       Left            =   240
  119.       TabIndex        =   8
  120.       Top             =   2040
  121.       Width           =   1455
  122.    End
  123.    Begin VB.Label lblCity 
  124.       Alignment       =   1  'Right Justify
  125.       Caption         =   "City:"
  126.       Height          =   255
  127.       Left            =   1320
  128.       TabIndex        =   3
  129.       Top             =   1080
  130.       Width           =   375
  131.    End
  132. Attribute VB_Name = "frmDBMan"
  133. Attribute VB_GlobalNameSpace = False
  134. Attribute VB_Creatable = False
  135. Attribute VB_PredeclaredId = True
  136. Attribute VB_Exposed = False
  137. Private Sub cmdOrderByPop_Click()
  138.   Dim strSQL As String
  139.   txtCurrency.DataField = ""
  140.   txtCurrency.Text = ""
  141.   strSQL = "SELECT * FROM Cities ORDER BY pop1995 ASC"
  142.   datCities.RecordSource = strSQL
  143.   datCities.Refresh
  144. End Sub
  145. Private Sub cmdQuit_Click()
  146.   End
  147. End Sub
  148. Private Sub cmdShowCurrency_Click()
  149.   Dim strSQL As String
  150.   strSQL = "SELECT city, Cities.country, Cities.pop1995, currency " & _
  151.     "FROM Cities INNER JOIN Countries " & _
  152.     "ON Cities.country=Countries.country " & _
  153.     "ORDER BY city ASC"
  154.   datCities.RecordSource = strSQL
  155.   datCities.Refresh
  156.   txtCurrency.DataField = "currency"
  157. End Sub
  158. Private Sub Form_Load()
  159.   'Look for the data base in the same folder as the program
  160.   datCities.DatabaseName = App.Path & "\MEGACTY2.MDB"
  161. End Sub
  162.